This invention relates to an apparatus for converting and reconverting color signals between two different color spaces, and more particularly to an apparatus where reconverted color signals are confined in their allowed dynamic ranges when, for example, R, G, B color signals are converted into corresponding Y, Cr, Cb color signals, subjected to data compression and data decompression, and reconverted into R, G, B color signals.
FIG. 1 shows a block diagram of an embodiment of this invention, which will be used for describing a prior art.
CPU 1 converts color signals according to the program stored beforehand in control ROM 2 using control RAM 3 as a working memory. Color signals in R, G, B color space are input and stored temporarily in control RAM 3 and converted into corresponding signals in Y, Cr, Cb color space by the conversion program. Converted color signals are registered in a filing device 4 after compressed by a picture data compressor 5. Picture data to be displayed on a display 8 are read out from the filing device 4, decompressed by a picture data decompressor 6 and are reconverted into corresponding color signals in R, G, B color space by the reconversion program. The reconverted R, B, G color signals are stored in a frame buffer memory 7 to be displayed on the display 8.
Conversion of color signals in R, G, B color space into corresponding signals in Y, Cr, Cb color space or reconversion vice versa should be completed in a high speed.
As prior arts developed for this purpose, there are Japanese patents laid open as preliminary patent publication No. 210771/""84 (hereafter called the first prior art) and No. 288684/""92 (hereafter called the second prior art).
As for conversion and reconversion of color signals between R, G, B color space and Y, Cr, Cb color space, following formula (1) and formula (2) are applied.                               "LeftBracketingBar"                                                                                                                Y                                                                                                  Cr                                                                                                                          Cb                                              "RightBracketingBar"                =                              "LeftBracketingBar"                                                            0.2963                                                  0.5926                                                  0.1111                                                                              0.7037                                                                      -                    0.5926                                                                                        -                    0.1111                                                                                                                    -                    0.2963                                                                                        -                    0.5926                                                                    0.8889                                                      "RightBracketingBar"                    ⁢                      "LeftBracketingBar"                                                                                                                              R                                                                                                            G                                                                                                                                          B                                                      "RightBracketingBar"                                              (        1        )                                          "LeftBracketingBar"                                                                                                                R                                                                                                  G                                                                                                                          B                                              "RightBracketingBar"                =                              "LeftBracketingBar"                                                            1                                                  1                                                  0                                                                              1                                                                      -                    0.5000                                                                                        -                    0.1875                                                                                                1                                                                      -                    0                                                                    1                                                      "RightBracketingBar"                    ⁢                      "LeftBracketingBar"                                                                                                                              Y                                                                                                            Cr                                                                                                                                          Cb                                                      "RightBracketingBar"                                              (        2        )            
It takes, however, a lot of time to convert and reconvert color signals by calculating these formulas.
To eliminate these calculations, conversion tables are used as shown in FIG. 7. In FIGS. 7, 1a, 1b, and 1c are input terminals of R, G and B signal, 4a, 4b, and 4c are output terminals of Y, Cr, and Cb signal, and 3a, 3b and 3c are corresponding conversion tables, for example.
Conversion or reconversion tables as shown in FIG. 7, however, need a lot of memory.
When R, G, B, Y, Cr and Cb signals have digital values of 8 bits, for example, table 3a has addresses of 24 bits (224) and data in each address needs 8 bits and so total amount of memory for table 3a, 3b and 3c require 402653/184 bits.
The first and the second prior arts are developed for economizing memory volume.
In the first prior art, the number of addresses of 3a, 3b and 3c is reduced as far as possible. Formula (1) shows that G has the greatest effect on Y and that the effect of G on Y is xc2xd and that of B is smaller than xc2xc of the effect of G on Y. So, when the number of addresses provided for G is 8 bits, the number of addresses provided for R can be reduced to upper 7 bits and the number of addresses provided for B to upper 6 bits with little decrease of accuracy. In the first prior art, the memory volume for conversion tables is thus economized.
In the second prior art, output data are obtained by calculating from intermediate data that are read out from intermediate conversion tables provided instead of full conversion tables, thus economizing the memory volume for tables.
FIG. 8 illustrates data format read out from the intermediate conversion tables in the second prior art.
Table 3a in FIG. 7, for example, has addresses of 24 bits corresponding to the value of R, G and B, and outputs 8 bits data of Y=0.2963R+0.5926G+0.1111B that is registered in each address and has the value calculated according to the formula (1).
In FIG. 8, data 81 is read out from an intermediate conversion table provided for R where data of Y=0.2963R, Cr=0.7037R and Cb=xe2x88x920.2963R is registered in each 8 bits address corresponding to the value of R. Data area is composed of a word of 32 bits and 30 of which are used and assigned for Y, Cb and Cr each by 10 bits.
Similarly, data 82 of Y=0.5926G, Cr=xe2x88x920.5926G, Cb=xe2x88x920.5926G and data 83 of Y=0.1111B, Cr=xe2x88x920.1111B and Cb=0.8889B are read out respectively from other conversion table. Data 84 that is obtained by adding data 82 and 83 to data 81 gives the output values of Y, Cr and Cb corresponding to the input value of R, G and B. Lower 10 bits of the data 84 gives the value of Y. The values of Cr and Cb are obtained from data 85 and data 86 that is obtained from data 84 by shifting right by 10 bits and 20 bits, respectively.
The first and the second prior arts are developed for economizing the memory volume of conversion tables and to reduce conversion and reconversion time.
However, in a heretofore known apparatus, including the first and the second prior arts, there remains another time consuming process.
FIG. 4 shows a flow chart illustrating reconversion process in a heretofore known apparatus and S401-S407 show steps of detailed processes.
At step S401, compressed data of Y, Cr, Cb in the filing device 4 are read out, decompressed at S402 and reconverted into R, G, B signals at S403. Values of R, G, B signals after reconversion may differ from those of original R, G, B signals and may go beyond their allowed dynamic ranges because fractions may be rounded off in the operations of conversion, reconversion, compression, decompression or in other processes. So, the values of signals after reconversion have to be checked and revised.
At step S404, the values of R, G, B signals after reconversion are checked if they go beyond their allowed dynamic range and the values which are out of ranges are replaced with the nearest values within their allowed dynamic ranges at step S405.
As signals developed in the frame buffer at step S407 are displayed directly on display 8, particularly the reconversion process as shown in FIG. 4 should be completed in a short time. However, the reconversion process in a heretofore known apparatus must be provided with time consuming steps S404 and S405.
Therefore, an important object of this invention is to eliminate these time consuming steps from the reconversion process of an apparatus for converting and reconverting color signals.
In order to achieve this object, values of Y, Cr, Cb signals converted from R, G, B signals are checked and compensated in this invention so that the values of R, G, B signals reconverted from Y, Cr, Cb signals are confined in their allowable dynamic ranges.
And in the compensation process for this purpose, it is sufficient to compensate only the value of Y signal leaving the values of Cr and Cb as they are, because Y signal has a largest effect on all of R, G and B signals as formula (2) shows.
When the dynamic ranges allowable for the values of R, G, B signals are all 0-255, for example, formula (2) shows that the value of Y must be in the range from Y=xe2x88x92Cr=YRL to YRL+255 for R signal to be in the range from 0 to 255, from Y=xe2x88x92Cb=YBL to YBL+255 for G signal and from Y=0.5 Cr+0.1875Cb=YGL to YGL+255 for B signal.
So, in order that all R, G, B signals have values within their dynamic ranges, it is sufficient to compensate the value of Y signal to the nearest value within the common range of the above mentioned three ranges.
Furthermore, reconversion tables may be omitted in this invention for reducing total memory volume required.